package com.hc.demo.domain;

import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 订单类
 */
public class Orders {
    private Integer userId;
    // 关键：指定日期格式与表单提交的格式一致（yyyy-MM-dd）
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date orderDate;
    private String address;
    private List<Cart> cartList=new ArrayList<>();

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public List<Cart> getCartList() {
        return cartList;
    }

    public void setCartList(List<Cart> cartList) {
        this.cartList = cartList;
    }

    @Override
    public String toString() {
        return "Orders{" +
                "userId=" + userId +
                ", orderDate=" + orderDate +
                ", address='" + address + '\'' +
                ", cartList=" + cartList +
                '}';
    }
}
